FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


cURL wat is it??





janszmatt
http://my2.php.net/curl
http://curl.haxx.se/

i read the content of both sites about cURL but I'm still quite confused about how it works. So i decide to create a script but it is related to the site http://www.neopets.com

Now i'm asking whether can i post the script for you guys to check it out and maybe repair for me.
S3nd K3ys
janszmatt wrote:
http://my2.php.net/curl
http://curl.haxx.se/

i read the content of both sites about cURL but I'm still quite confused about how it works. So i decide to create a script but it is related to the site http://www.neopets.com

Now i'm asking whether can i post the script for you guys to check it out and maybe repair for me.


Go for it. Shocked

As long as it's legal software for a legal purpose, I mean.
janszmatt
i decide not to post the code but i have a question to ask

if i have a code like this

Code:
<form action='spin2.phtml' method='get'>
<input type='submit' value='Spin Spin Spin!!'>
</form>


how do i have a curl action to press the submit button or some other action

n does frihost support curl?
hexkid
janszmatt wrote:
how do i have a curl action to press the submit button or some other action

When the method is GET (as it is in your example), just supply the form fields in the URL
Code:
// ...
curl_setopt($channel, CURLOPT_URL, HTTP_BASE . 'spin2.html?submit=Spin%20Spin%20Spin%21%21');
// ...
Notice that in this code I've used HTTP_BASE which is a constant you should define (maybe 'http://www.neopets.com/'?); also the URL parameters should be encoded ("Spin Spin Spin!!" encoded is "Spin+Spin+Spin!!").

Don't forget the manual:
http://php.net/curl
http://php.net/curl_setopt
http://php.net/rawurlencode

janszmatt wrote:
n does frihost support curl?
Yes.
janszmatt
i dont understan the
Code:
HTTP_BASE
hexkid
janszmatt wrote:
i dont understan the
Code:
HTTP_BASE

Shorthand coding Smile
Just replace it with the URL you want to use for cURL.

The idea behind the HTTP_BASE is this
Code:
<?php
define('HTTP_BASE', 'http://www.neopets.com/');
// ...
curl_setopt($ch1, CURLOPT_URL, HTTP_BASE . 'spin2.html');
// ...
curl_setopt($ch2, CURLOPT_URL, HTTP_BASE . 'spin2.html?submit=Spin+Spin+Spin!!');
// ...
curl_setopt($ch3, CURLOPT_URL, HTTP_BASE . 'logout.html');
// ...
?>


and when "neopets.com" moves domains to "BRANDNEWneopetsV2.com" you just have to change 1 line in your code.
Related topics
wat r u listening 2 right now?
Curl and OpenSSL
[HDTV] Wat is het precies?
Wat vond je van de intocht van sinterklaas?
Wat vind jij van homoseksuelen?
Wat moet je met zo een zoon!!!!
Wat is het maximaal ..
Wat is er gebeurd met mijn account?
cURL extensions?
Curl
Waarover gaan jullie sites?
Wat voor domein krijg je?
.sql problem
PHP cURL Uitleg/Tutorials?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.