Solved

Curl problem

Posted on 2008-06-19
3
398 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 500 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
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…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

739 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