Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

curl - no output

Status
Not open for further replies.

KryptoS

Programmer
Feb 7, 2001
240
BE
Hey,

I'm using cURL. On my local server it's all working fine. But when I install it on my website it just give me no output. I read on the php website:

For some reason on some webservers it may not be able to understand what cURL is doing. If you're getting unexpected results (like getting no output when the URL is valid) while using curl_init(). Add a trailing slash '/' after the url if you haven't done so already.

$url1 = "
this is my url. but when I put a '/' at the end it just stays the same...

Another option is to contact my hoster. But what does he have to do to let ik work?

Anyone a solution?

thanks!

greetings

The One And Only KryptoS
 
this is a part of the code. I didn't program it myself so...

Code:
$file = fopen("cookie.txt", "w+");  fclose($file);
$url1 = "[URL unfurl="true"]http://collect.myspace.com/index.cfm?fuseaction=login.process";[/URL]

$header_myspace_collect = array(
"Host: collect.myspace.com",
$agent,
"Content-Type: application/x-[URL unfurl="true"]www-form-urlencoded",[/URL]
"Content-Length: " . $contentlength);
$header_myspace_home = array(
"Host: home.myspace.com",
$agent);

$agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";

$postvars = "email=$email&password=$password";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header_myspace_collect);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);
$myspace_collect_return = curl_exec($ch);

The One And Only KryptoS
 
ok, sorry, the code is long. So I'll post the link to the code. I didn't program it. I just have to get it work for a friend (who also didn't program it). But I think it's something about the configuration of the webserver. 'cause it works fine on my pc...

code here



The One And Only KryptoS
 
What output does it produce on your machine, but not the web server? I don't see any code there where it would produce output under any circumstances.

Perhaps your settings are masking important error output. What are the settings in the web server's php.ini for display_errors and error_reporting? If you want maximum debugging information, I'd recommend "on" and "E_ALL", respectively.


Want the best answers? Ask the best questions! TANSTAAFL!
 
ok sorry, stupid of me... after this code I just put some html, but I removed it because it was off no use for this code...

but there is normally code after de php code


Yeah, but I can't debug it. 'Cause it's on a webserver from my host. So, I can't get the php.ini. But like I said: 'on my pc it's all working fine'. I'm going to contact my host.

thanks anyway

The One And Only KryptoS
 
so I did this:

ini_set("display_errors","On");
error_reporting (E_ALL);

but it gives nothing...


But I noticed that $file = fopen("cookie.txt", "w+"); doesn't make the cookie file on the server?

The One And Only KryptoS
 
you might have to set display_startup_error to "1" too. and try setting display_errors to "1" and not "On" (shouldn't matter, but worth a try).

display_errors will not make a difference if your script has fatal (parse) errors since the script will not start running until it has parsed correctly.

with many host-installs you can upload a file called php.ini to the directory in question and the local values will (unless overridden) supersede the default values. so also try uploading a php.ini file with the relevant directives present. it must be to the same directory as the script.
 
Hey,

I contacted my host and could fix the problem. The cURL is now working fine.

Thanks anyway. I learned a lot. About errors. And I also didn't know that I could upload myself a php.ini.
But my host explained how I could do it...

No I need to fix the rest of the script.

Greetings

The One And Only KryptoS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top