Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Curl problem

Posted on 2008-06-19
3
Medium Priority
?
413 Views
Last Modified: 2008-06-19
Hi,
I am using the following code

        $ch = curl_init("http://www.mortgages.ie/rates_new.cfm");
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $output = curl_exec($ch);      
        curl_close($ch);
        echo $output;

the output i get is 1, i dont get the whole page displayed?
0
Comment
Question by:markmchugh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Expert Comment

by:kszurek
ID: 21821347
Mayby:
echo file_get_contents('http://www.mortgages.ie/rates_new.cfm');

Open in new window

0
 
LVL 19

Expert Comment

by:bevhost
ID: 21821372
why is the CURLOPT_POST there?
there isn't any data to POST.
Should be a GET.
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 2000 total points
ID: 21821405
The code is working, but the URL you quers does not return anything or has a protection against script usage.

If you use:
$ch = curl_init("http://www.example.com/");
$ch = curl_init("http://www.mortgages.ie/mortgages/rates.cfm");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_USERAGENT, 'User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.8.1.14) Gecko/20080410 SUSE/2.0.0.14-2.3 Firefox/2.0.0.14');
$output = curl_exec($ch);
curl_close($ch);
echo $output;


it works
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question