473,804 Members | 3,311 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help With CURL And GET Forms

I have used curl_setopt($ch , CURLOPT_POST, true); and curl_setopt($ch ,
CURLOPT_POSTFIE LDS, $data); on post forms to retrun results, but what
about a GET Form Method? How do you deal with these with curl? The
same commands?

The particular instance I am dealing with is a store locator and it is
not as easy as just calling the url with the variables becasue it runs
some script behind the scene that does a bunch of calculations for
calculating the lat. and lon. of the store so it can call a mappoint
map. After the form submission the url is a mess and pretty customized
to the zip code searched with lat and lon.

Here is an example of the form action:
<form Method="GET"
Action="http://go.mappoint.net/ccc/Geocode.aspx?br and=h&amp;FC=cc c&amp;FC=ccc"
Name="OutsideUS ">

Here is an mocked up example of a resulting URL after the form
submission:

http://go.mappoint.net/ccc/PrxResult...=isccc&brand=a

How would I deal with this in curl? Your help is much appreciated.

Thank you!

Dec 1 '06 #1
1 1845
devranger wrote:
I have used curl_setopt($ch , CURLOPT_POST, true); and curl_setopt($ch ,
CURLOPT_POSTFIE LDS, $data); on post forms to retrun results, but what
about a GET Form Method? How do you deal with these with curl? The
same commands?

The particular instance I am dealing with is a store locator and it is
not as easy as just calling the url with the variables becasue it runs
some script behind the scene that does a bunch of calculations for
calculating the lat. and lon. of the store so it can call a mappoint
map. After the form submission the url is a mess and pretty customized
to the zip code searched with lat and lon.

Here is an example of the form action:
<form Method="GET"
Action="http://go.mappoint.net/ccc/Geocode.aspx?br and=h&amp;FC=cc c&amp;FC=ccc"
Name="OutsideUS ">

Here is an mocked up example of a resulting URL after the form
submission:

http://go.mappoint.net/ccc/PrxResult...=isccc&brand=a
>
How would I deal with this in curl? Your help is much appreciated.

Thank you!
Hi,

I think just assembling the URL should do the trick.
So just add all name/value pairs you have to the url.
eg:
$baseURL = "http://go.mappoint.net ?";
// assuming you have your info in an assoc-array:
$myNameValues = array(
"LOC" ="23.327467234" ,
"CT" ="34.8793276 89"
);

// urlencode all values
$urlEncodedPart s = array();
foreach ($myNameValues as $key =$value){
$urlEncodedPart s = $key."=".urlenc ode($value);
}

// add to baseurl
$baseURL .= implode("&",$ur lEncodedParts );
Then just use the baseurl in CURL without POST-options.

(Not tested)

Regards,
Erwin Moller
Dec 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
12599
by: Conrad F | last post by:
Hi, If any Microsoft people are listening.... Are there any plans for the new web language called "Curl" to be supported in .NET (ASP.NET)? I ask as Curl represents the first step to true OO programming of web pages and not just running "scripts" which have in-roads into service DLLs of other languages such as C#. Surely MS will put Curl into .NET at some time since it is designed to work with DirectX and OpenGL?
27
2602
by: Scott | last post by:
I've been trying to come up with a way to ensure user input is coming from the form on my site, and not auto-submitted from elsewhere, and I don't want to use the "enter the code shown in the image" method. I know the $_SERVER contents can be spoofed, so I thought of doing something similar to this: <?php session_start(); $code = mt_rand(0,1000000); $_SESSION = $code;
0
5609
by: info | last post by:
Dear all, is the first time that I use SOAP, and i must say that i'm having several problems. this is SOAP message that expects the server =================XML EXPECTED FROM THE SERVER================ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
0
5862
by: nfhm2k | last post by:
I've been trying to find a solution to this for quite some time now... I even took a look at existing scripts... Including this one... http://groups.google.co.uk/group/comp.lang.php/browse_thread/thread/2e052386da903425/b03ec83ac55273a2?lnk=st&q=&rnum=1#b03ec83ac55273a2 Everyone on that post seems to say its to do with the cookie's, yet if infact they had tried this script they would have found that even with the cookies enabled this...
6
1982
by: admin | last post by:
Hi, I have a mysql box that has a private network ip. The old developer was running our web server on this machine but the company since retired the box and it is in a closet, still running, but sad and alone, aliased as oldserver.mycompany.com. Now I am finding out that I need to use some of the funcitonality in the scripts that are on the old box.
3
2639
by: Chuck Renner | last post by:
Please help! This MIGHT even be a bug in PHP! I'll provide version numbers and site specific information (browser, OS, and kernel versions) if others cannot reproduce this problem. I'm running into some PHP behavior that I do not understand in PHP 5.1.2. I need to parse the HTML from the following carefully constructed URI:
1
1650
by: devranger | last post by:
Hello, I am in the process of learning PHP CURL and in doing some test examples I am having some issues with CURL that I do not fully understand. I am doing a test to use CURL to post and return results from "http://powersports.honda.com/dealer_locator/dealer_locator.asp" However it does not appear to be returning results from the CURL post action. What CURL appears to be doing is finding the page...
9
2030
by: devranger | last post by:
I am using the below CURL Function and can not figure out why it is not retruning the results from the post. Can anyone take a look and tell me what I may be doing wrong? I am just not seeing it. As you can see at the bottom of the script if (strstr($Line, 'HOUSTON YAMAHA MOTORSPORTS')) then it is reading the correct page, otherwise if (strstr($Line, 'Yamaha Dealer Locator')) then it is reading the incorrect page of the initial URL...
1
4910
by: c1pkw | last post by:
Hi there, I’m having a real heap of trouble with PHP and cURL My aim is to use this code (or something like it) to submit 2 fields to a remote server (using GET) and receive back 6 fields (again with GET). When I run the function below, I get back a 401 unauthorized error although the Username and Password are correct. Presumably then, they are not reaching the remote server at all or in the correct state. Problem is, I know so...
0
10589
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7625
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.